import bsddb
db = bsddb.btopen('/tmp/spam.db', 'c')
db['dbkey'] = 'dbvalue'
db['key2'] = 'value2'
db['key3'] = 'value3'
db['key4'] = 'value4'
print db.last()
d = {'key': 'value'}
print d.get('key', 'not found')
print db.get('dbkey', 'not found')
print d
print db
v = db.pop('dbkey',None)
print v
print db
del db['key2']
print db
print db.last()
print db.last()[0]
print len(db)


